// 导入数据库
const db = require("../db/index");

//获取列表的处理函数
exports.getMjjcList = (req, res) => {
  const sqlstr = "select * from mjjc";
  db.query(sqlstr, (err, result) => {
    if (err) return res.cc(err);
    res.send({
      status: 0,
      message: "请求成功",
      data: result,
    });
  });
};

//根据id获取对应列表的处理函数
exports.getMjjcListId = (req, res) => {
  const sqlstr = "select * from mjjc where id = ?";
  db.query(sqlstr, req.params.id, (err, result) => {
    if (err) return res.cc(err);
    res.send({
      status: 0,
      message: "请求成功",
      data: result,
    });
  });
};
